/*
 * @lc app=leetcode.cn id=3 lang=cpp
 *
 * [3] 无重复字符的最长子串
 */

// @lc code=start
#include <string>


class Solution {
public:
    int lengthOfLongestSubstring(string s)
{
    int _max = 0;
    int temp = 0;
    for (int i = 0; i < s.size(); ++i)
    {
        unordered_map<char, int> tempS;
        for (int j = i; j < s.size(); ++j)
        {
            auto it = tempS.find(s[j]);
            if (it != tempS.end())
            {
                it->second = it->second + 1;
                break;
            }
            else
            {
                tempS[s[j]] = 1;
                temp = j - i + 1;

            }
        }
        _max = max(_max, temp);
        temp= 0;
    }

    return _max;
}
};
 
// @lc code=end